import { computed } from 'vue'
export function useVModel(props, propName, emits) {
  return computed({
    get() {
      return new Proxy(props[propName], {
        get(target, key, receiver) {
          return Reflect.get(target, key, receiver)
        },
        set(target, key, value) {
          console.log('key',key,'value',value)
          emits(`update:${propName}`, { ...target, [key]: value })
          return true
        }
      })
    },
    set(val) {
      emits(`update:${propName}`, val)
    }
  })
}